package net.godcode.olivenotes.entities;

import org.hibernate.Query;
import org.hibernate.Session;

/**
 * TagDAOHibernate
 * 
 * @author Chris Lewis Dec 27, 2007 <chris@thegodcode.net>
 * @version $Id: TagDAOHibernate.java 20 2008-01-15 07:22:45Z burningodzilla $
 */
public class TagDAOHibernate extends GenericHibernateDAO<Tag, Long> implements TagDAO {
	
	public TagDAOHibernate(Session session) {
		super();
		setSession(session);
	}
	
	public Tag findByName(String name) {
		Query q = getSession().createQuery("from Tag where name=:name"); //TODO named query
		q.setParameter("name", name);
		return (Tag)q.uniqueResult();
	}

}
